import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class MyHttpServlet extends HttpServlet {

    protected void doGet( HttpServletRequest request,
                          HttpServletResponse response)
            throws ServletException, IOException {
        //设置字符编码
        response.setCharacterEncoding("utf8");
        response.setContentType("text/html;charset=utf-8");
        response.getWriter().write("<html><body>GET响应</body></html>");

//        response.sendRedirect("http://qikegu.com");

//        RequestDispatcher requestDispatcher = request.getRequestDispatcher( "/new.jsp");
//        requestDispatcher.include(request, response);
//
//        response.getWriter().write("<html><body>GET响应2</body></html>");

    }
}